package com.letfox.ad.controller.ad;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.letfox.ad.controller.BaseController;
import com.letfox.ad.service.PlanUserService;
import com.letfox.common.model.ResultResponse;

@Controller
@RequestMapping(value = "/planUser")
public class ADPlanUUserController extends BaseController{
	
	private Logger logger = LoggerFactory.getLogger(getClass());
	
	@Autowired
	private PlanUserService PlanUserService;
	
	@RequestMapping(value = "/addPlanUser",method=RequestMethod.POST)
	@ResponseBody
	public ResultResponse addPlanUser(@RequestParam String accountId,@RequestParam String planId){
		try {
			resultResponse=PlanUserService.insertPlanAccount(accountId,planId);
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
		}
		return resultResponse;
	}
	
	@RequestMapping(value = "/selectPlanUser",method=RequestMethod.POST)
	@ResponseBody
	public ResultResponse selectPlanUser(@RequestParam String accountId,
			@RequestParam String startCreateTime,
			@RequestParam String endCreateTime, @RequestParam String startTime,
			@RequestParam String endTime) {
		try {
			resultResponse=PlanUserService.selectUserADLiset(accountId, startCreateTime, endCreateTime, startTime, endTime);
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
		}
		return resultResponse;
	}
}
